<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\assets\TimelineAsset;
use app\modules\clinical\models\ExcelPd;

/* @var $this yii\web\View */
/* @var $model app\models\ExcelPd */
/* @var $form yii\widgets\ActiveForm */

TimelineAsset::register($this);

$model->clear();
$med = $model->getMedCtns();
$append = $model->getMedList('PD');
?>

<style type="text/css">
    .question > select {width: 108px;}
    .question > label {width: 390px; margin-bottom: 0;}
    .table {width: 550px;}
</style>

<section class="cd-horizontal-timeline">
<div class="timeline">
  <div class="events-wrapper">
    <div class="events">
      <ol id="timelineList">
        <li><a href="#0" data-date="16/01/2014" class="selected">现病史</a></li>
        <li><a href="#0" data-date="28/02/2014">治疗信息</a></li>
        <li><a href="#0" data-date="20/04/2014">问卷填写</a></li>
      </ol>

      <span class="filling-line" aria-hidden="true"></span>
    </div> <!-- .events -->
  </div> <!-- .events-wrapper -->
        
</div> <!-- .timeline -->

<div class="events-content">
  <ol>
    <li class="selected" data-date="16/01/2014">

    <!-- <h3>现病史：</h3> -->
    <div class="form-group">
      <?= Html::label('患者姓名', 'pt_rel') ?><br />
      <?= Html::dropDownList('pt_rel', (!empty($pt_rel)) ? $pt_rel : 0, $pt_rel_list, ($model->isNewRecord) ? ['class' => 'pt_rel_list'] : ['class' => 'pt_rel_list', 'disabled' => 'true']) ?>
    </div>

    <div class="form-group">
      <?= Html::label('评估时间', 'evaluation_time') ?><br />
      <?= Html::textInput('evaluation_time', empty($evaluation_time) ? '' : $evaluation_time, ['class'=>'form-control laydate-icon date']) ?>
    </div><br />

    <?= $form->field($model, 'classify')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'ft_ill_time')->textInput(['value' => date("Y-m", $model->ft_ill_time), 'class'=>'form-control laydate-icon date-y-m'])->error(false) ?><br />

    <?= $form->field($model, 'ft_part')->checkboxList(ExcelPd::getParams('illPart'))->error(false) ?><br />

    <?= $form->field($model, 'ft_symptom')->textarea(['maxlength' => true]) ?><br />

    <?= $form->field($model, 'ft_process')->textarea(['maxlength' => true]) ?><br />

    </li>

    <li data-date="28/02/2014">

    <!-- <h3>治疗信息：</h3> -->

    <?= $form->field($model, 'ft_md_time')->textInput(['value' => date("Y-m", $model->ft_ill_time), 'class'=>'form-control laydate-icon date-y-m'])->error(false) ?>

    <?= $form->field($model, 'up_time')->textInput(['class'=>'form-control laydate-icon time'])->error(false) ?>

    <?= $form->field($model, 'bf_time')->textInput(['class'=>'form-control laydate-icon time'])->error(false) ?><br />

    <?= $form->field($model, 'lc_time')->textInput(['class'=>'form-control laydate-icon time'])->error(false) ?>

    <?= $form->field($model, 'dn_time')->textInput(['class'=>'form-control laydate-icon time'])->error(false) ?>

    <?= $form->field($model, 'sl_time')->textInput(['class'=>'form-control laydate-icon time'])->error(false) ?>

    <!-- 这里真心不好写。虽然我知道不应该这么写 -->
    <table border="1px" class="tb-med-list">
        <tr>
            <td rowspan="2">药物名称</td>
            <td colspan="7">上午</td>
            <td colspan="10">下午</td>
        </tr>
        <tr>
        <?php for ($i = 6; $i < 23; $i ++) : ?>
            <td><?= $i ?></td>
        <?php endfor;?>
        </tr>
        <?php foreach ($append as $list) : ?>
        <tr>
            <td>
                <?= $list['med_name'] ?>
            </td>
            <?php for ($i = 6; $i < 23; $i ++) : ?>
            <td><input type="text" name="MedCtn[<?= $list['pk_id'].'_'.$i ?>]" value="<?= empty($med[$list['pk_id']][$i]) ? '' : $med[$list['pk_id']][$i] ?>"></td>
            <?php endfor;?>
        </tr>
        <?php endforeach; ?>
            
    </table>

    <?= $form->field($model, 'else_ctnt', ['labelOptions' => ['class' => 'lg_area']])->textarea(['maxlength' => true]) ?><br />

    <?= $form->field($model, 'treatment')->radioList(ExcelPd::getParams('operation'), ['class'=>'radioList'])->error(false) ?>

    </li>

    <li data-date="20/04/2014">
    近一个月来有无下列症状：是=1，否=0（一个月前有某种症状而近一个月消失，须回答“否”）
    <table class="table">
      <?php for ($i = 1; $i <= 30; $i ++) : ?>
      <tr><td>
      <?= $form->field($model, 'q_'.$i, ['options' => ['class' => 'control-label question']])->listBox(ExcelPd::getParams('yesno'))->error(false) ?>
      </td></tr>
    <?php endfor;?>
    <tr><td>总分：<span id="totalScore"></span></td></tr>
    </table>
    </li>
  </ol>

  
</div> <!-- .events-content -->
</section>
